{% extends "personal_center/base.html" %}

{% block page_link %}

{% endblock %}


{% block style %}
    <style>
        .add_class{
            background: #1E90FF;
        }
        .add_background {
            background: #A9A9A9;
        }
        tr {
            height: 35px;
        }

        th {
            text-align: center;
        }

        table {
            table-layout: fixed;
        }

        td:first-child, th:first-child {
            position: sticky;
            left: 0; /* 首行永远固定在左侧 */
            z-index: 1;
        }

        thead tr th {
            position: sticky;
            top: 0; /* 列首永远固定在头部  */
            background-color: #E8E8E8;
        }

        th:first-child {
            z-index: 2;
        }

        .li-class {
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
        }
        .top_tag {
            border-bottom: #01AAED solid 2px;
            color: #01AAED;
        }

        .tab_top {
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }
        #addForm {
            width: 800px;
            height: 620px;
            background: #F5F5F5;
            position: absolute;
            border: #dfdfdf solid 1px;
            margin: auto;
            border-radius: 3px;
            top: 50%;
            left: 50%;
            /* 实现鼠标拖拽使用css3效果 */
            transform: translate(-50%, -50%);
            display: none;
            z-index: 10100;
            font-size: 0;
        }

        /* 标题 */
        #title {
            display: flex;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 10px;
            height: 50px;
            color: #0b0b0b;
            cursor: move;
            /*border: #dfdfdf solid 1px;*/
            width: 100%;background: #f4f7fa;border-top-left-radius: 5px;border-top-right-radius: 5px;
        }

        .search {
            width: 300px;
            display: flex;
            float: right;
            margin: 10px 0;
            margin-right: 1%;
            /*border: 1px solid red;*/
        }

        .search input {
            vertical-align: middle;
            float: left;
        / / 左浮动 flex: 4;
            height: 30px;
            width: 230px;
            outline: none;
            border: 1px solid #0070c1;
            box-sizing: border-box;
        / / 盒子模型，怪异IE盒子模型，width = content + border * 2 + padding * 2 padding-left: 10 px;
            border-bottom-left-radius: 3px;
            border-top-left-radius: 3px;
        }

        .search button {
            float: right;
            flex: 1;
            height: 30px;
            width: 70px;
            line-height: 30px;
            background-color: #0070c1;
            color: white;
            border-style: none;
            outline: none;
            border-bottom-right-radius: 3px;
            border-top-right-radius: 3px;
        }

        .search button i {
            font-style: normal;
        }

        .search button:hover {
            font-size: 16px;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 40px;background: white;border-bottom: #A9A9A9 solid 0.5px;line-height: 40px;padding-left: 1%;color: black;">
        <div id="notice_detail" class="tab_top top_tag">
            <i class="iconfont icon-zhangdan_xiangqing_o" style="font-size: 20px;"></i> 审批详情
        </div>

        <div style="width: 15%;text-align: center;height: 100%;line-height: 40px;float: right;">
            <button id="add_station" type="button" style="width: 100px;height: 30px;margin-top: 5px;border-radius: 3px;border: #1E90FF solid 1px;background-color: #1E90FF;color: white;line-height: 30px;" onclick="ExportCar()">
                提交
            </button>
        </div>
    </div>

    <div id="new_models" style="width: 80%;height: 80%;position: absolute;display: none;">
        <div style="width: 700px;height: 500px;background: #F5F5F5;z-index: 10100;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #dfdfdf solid 1px;">
            <div id="box" style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                <h5 id="modal-title" class="modal-title" style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;">车辆审批</h5>
                <span onclick="close_models()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
            </div>
            <hr>
            <div style="height: 400px;width: 100%;padding-top: 2%;padding-left: 2%;">
                <div>
                    <label for="" style="vertical-align: top;">审批：</label>
                    <input type="radio" name="approve" value="audit" checked>同意
                    <input style="margin-left: 3%;" type="radio" name="approve" value="draft">不同意
                </div>

                <div id="select_option" style="display: none;margin-top: 2%;width: 100%;">
                    <label for="">分派车辆：</label>
                    <select name="" id="select_tag" style="border-radius: 3px;border: #F5F5F5 solid 1px;" >
                        {% for foo in position %}

                        {% endfor %}
                    </select>
                    <label for="" style="margin-left: 3%;">司机：</label>
                    <select name="" id="select_drive" style="border-radius: 3px;border: #F5F5F5 solid 1px;" >
                        {% for foo in position %}

                        {% endfor %}
                    </select>
{#                    <input id="drover" type="text" style="width: 200px;height: 30px;padding-left: 1%;border: #cccccc solid 1px;border-radius: 3px;" disabled>#}
                </div>

                <div style="margin-top: 2%;width: 100%;">
                    <label for="" style="vertical-align: top;">意见：</label>
                    <textarea name="" id="opinion_detail" cols="30" rows="10" style="width: 90%;"></textarea>
                </div>
            </div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 2%;">
                <button onclick="summit_data()" style="width: 100px;height: 30px;border: #dfdfdf solid 1px;margin-top: 10px;border-radius: 3px;background: #1E90FF;color: white;">提交</button>
            </div>
        </div>
    </div>

    <div style="width: 100%;height: 94%;background-color: white;overflow: auto;">
        <div style="width: 100%;height: 100%;display: inline-block;vertical-align: center;">
            <div style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;margin-top: 1%;background: #dfdfdf;">
                申请详情
            </div>

            <div style="width: 95%;margin-left: 2.5%;">
                <table style="width: 100%;">
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            申&nbsp; &nbsp; 请&nbsp; &nbsp; 人
                        </td>
                        <td id="applicat"
                            style="width: 30%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;"></td>

                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            申请部门
                        </td>
                        <td id="department"
                            style="width: 30%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">{{ department }}</td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            开&nbsp; 始&nbsp;时&nbsp;间
                        </td>
                        <td id="start_time" style="width: 30%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;">
                            <input id="car_start1" type="text" style="width: 100%;border: none;">
                        </td>

                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;">
                            结束时间
                        </td>
                        <td id="end_time" style="width: 30%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;">
                            <input id="car_end1" type="text" style="width: 100%;border: none;">
                        </td>
                    </tr>
                </table>

                <table style="width: 100%;">

                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            行&nbsp; 程&nbsp;路&nbsp;线
                        </td>
                        <td id="itinerary" style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;" contenteditable="true"></td>
                    </tr>

                </table>

                <table style="width: 100%;">
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            用&nbsp; 车&nbsp;领&nbsp;导
                        </td>
                        <td id="leaders" style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;">
                            <select name="" id="use_car_leaders" style="width: 100%;height: 100%;border: none;">

{#                                <option value="">请选择用车领导</option>#}
{#                                <option value="梁东(6688)">梁东</option>#}
{#                                <option value="叶霖(6888)">叶霖</option>#}
{#                                <option value="陈训军(8006)">陈训军</option>#}
{#                                <option value="周剑(8008)">周剑</option>#}
{#                                <option value="何治武(8011)">何治武</option>#}
{#                                <option value="李可军(8101)">李可军</option>#}
{#                                <option value="朱斌(8121)">朱斌</option>#}
{#                                <option value="李卫东(8282)">李卫东</option>#}
{#                                <option value="戴立勇(8818)">戴立勇</option>#}
{#                                <option value="李蕾(9643)">李蕾</option>#}
                            </select>
                        </td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            同&nbsp; 行&nbsp;人&nbsp;员
                        </td>
                        <td id="field" style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;"  onclick="entrust()"></td>
                    </tr>
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;text-align: right;">
                            用&nbsp; 车&nbsp;事&nbsp;由
                        </td>
                        <td id="car_marks" style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;height: 35px;line-height: 35px;padding-left: 1%;" contenteditable="true"></td>
                    </tr>
                </table>
                <table id="drive_car" style="width: 100%;display: none;">
                    <tr style="margin-left: 1%;">
                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;border-top: none;">
                            拟&nbsp; 派&nbsp;车&nbsp;辆
                        </td>
                        <td id="vehicle_name" style="width: 30%;height: 35px;line-height: 35px;padding-left: 1%;border: #cfcfcf solid 0.5px;border-top: none;"></td>

                        <td style="width: 8%;border: #cfcfcf solid 0.5px;text-align: right;height: 35px;line-height: 35px;border-top: none;">
                            司机
                        </td>
                        <td id="driver_name" style="width: 30%;border: #cfcfcf solid 0.5px;padding-left: 1%;line-height: 35px;border-top: none;"></td>
                    </tr>
                </table>
            </div>

            <div style="width: 95%;margin-left: 2.5%;height: 40px;padding-left: 0.5%;line-height: 40px;background: #dfdfdf;">
                审批详情
            </div>
            <div style="width: 95%;margin-left: 2.5%;">
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;text-align: right;">
                            分&nbsp; 管&nbsp;领&nbsp;导
                        </td>
                        <td style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;padding-left: 1%;">
                            <div id="fg" style="width: 100%;">

                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;text-align: right;">
                            车队负责人
                        </td>
                        <td style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;padding-left: 1%;">
                            <div id="yb" style="width: 100%;">

                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 8%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;text-align: right;">
                            车管办分管领导
                        </td>
                        <td style="width: 68%;border-right: #cfcfcf solid 0.5px;border-left: #cfcfcf solid 0.5px;border-bottom: #cfcfcf solid 0.5px;line-height: 35px;padding-left: 1%;">
                            <div id="cg" style="width: 100%;">

                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    <div id="addForm">
        <!-- 标题 -->
        <div id="title">
            <h5 style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;font-size: 18px;">选择同行人员</h5>
            <div class="search" style="vertical-align: center;display: inline-block;text-align: right;margin-left: 35%;font-size: 14px;">
                <input type="text" placeholder="请输入..." name="" id="search_data" value="">
                <button id="search_button">搜索</button>
            </div>
            <span onclick="close_models1()" style="float: right;line-height: 50px;padding-right: 2%;cursor: pointer;"><i class="iconfont icon-quchu"></i></span>
        </div>
        <hr>
        <div style="display: inline-block;width: 30%;height: 350px;border-right: #E8E8E8 solid 1px;">
            <div style="width: 100%;height: 35px;line-height: 35px;padding-left: 2%;color: #0b0b0b;border-bottom: #cfcfcf solid 1px;font-size: 14px;">
                <div id="an_branch"
                     style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;color: #01aaed;">
                    按部门
                </div>
                <div id="an_rank"
                     style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按权限
                </div>
                <div id="an_func"
                     style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按职能
                </div>
            </div>
            <div id="department_list" style="width: 100%;height: 315px;overflow: auto;">
                <div style="width: 100%;height: 100%;text-align: center;">
                    <img style="width: 30%;height: 30%;margin-top: 35%;"
                         src="../../static/public_file/images/jiazai.gif" alt="">
                </div>
            </div>
        </div>

        <div style="display: inline-block;width: 70%;height: 350px;overflow: auto;vertical-align: top;left: 0;font-size: 14px;">
            <table class="table table-hover table-bordered"
                   style="border-collapse: collapse;margin: 0;padding: 0;">
                <thead>
                <tr>
                    <th scope="col" style="width: 10%;">
                        <input id="all_select_checkbox" type="checkbox">
                    </th>
                    <th scope="col" style="width: 20%;">序号</th>
                    <th scope="col" style="width: 35%;">姓名</th>
                    <th scope="col" style="width: 35%;">工号</th>
                </tr>
                </thead>
                <tbody style="overflow: auto;" id="t_table2"></tbody>
            </table>
            <div id="img-display1" style="width: 75%;text-align: center;">
                <div style="margin-top: 10%;">
                    <img src="../../static/public_file/images/page-img/11.jpg" alt="">
                    <p style="margin: 0;padding: 0;vertical-align: top;">暂无数据</p>
                </div>
            </div>
        </div>

        <div style="height: 150px;width: 100%;border-top: #E8E8E8 solid 1px;overflow: auto;">
            <div id="checked-label" style="margin-top: 1%;margin-left: 3%;width: 90%;font-size: 14px;">

            </div>
        </div>
        <hr>
        <div style="height: 70px;padding-right: 2%;font-size: 14px;">
            <button onclick="summit_val()" id="model-affirm" style="border-radius: 3px;height: 30px;float: right;margin-top: 15px;border: #1E90FF solid 1px;background: #1E90FF;color: white;">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提&nbsp;交&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </button>
        </div>
    </div>

{% endblock %}


{% block script %}
    <script type="text/javascript" src="../../static/public_file/other/jquery.js"></script>
    <script src="../../static/administrative/layDate-v5.0.9/laydate/laydate.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("sponsor").className = "add_class";
            document.getElementById("personage").className = "add-nav-active";
            request_data();
        };

        var already_type = "{{ already_type | safe }}";
        if (already_type){
            document.getElementById("summit_button").style.display="none";
        }

        lay('#version').html('-v' + laydate.v);

        //执行一个laydate实例
        laydate.render({
            elem: '#car_start1' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#car_end1' //指定元素
        });

        let title1 = document.querySelector("#title");
        let addForm1 = document.querySelector("#addForm");

        title1.addEventListener("mousedown", function (e) {
            let x = e.pageX - addForm1.offsetLeft;
            let y = e.pageY - addForm1.offsetTop;


            document.addEventListener("mousemove", move);
            function move(e) {
                addForm1.style.left = e.pageX - x + 'px';
                addForm1.style.top = e.pageY - y + 'px';
            }

            document.addEventListener("mouseup", function (e) {
                document.removeEventListener("mousemove", move);
            })
        });

        var returnList = {{ returnList | safe }};

        function request_data() {       // type_s: 1、全部查询，2、查询我的申请，3、查询我的审批
            document.getElementById("loading").style.display = "inline-block";
            var request_id = window.location.href.split("id=")[1].replace("#", '');
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('get', "/personal-center/VehicleApplyDetail?id=" + String(request_id));
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        document.getElementById("applicat").innerText=JsonDate["data_dic"]["apply_user"];
                        document.getElementById("department").innerText=JsonDate["data_dic"]["department"];
                        document.getElementById("itinerary").innerText=JsonDate["data_dic"]["route"];
                        document.getElementById("field").innerText=JsonDate["data_dic"]["temp_travelers"].replace("()", "");
                        document.getElementById("car_marks").innerText=JsonDate["data_dic"]["subject"];
                        document.getElementById("car_start1").value=JsonDate["data_dic"]["start_time"]+":00";
                        document.getElementById("car_end1").value=JsonDate["data_dic"]["end_time"]+":00";
                        if (JsonDate["data_dic"]["drivers"]){
                            document.getElementById("drive_car").style.display="table";
                            document.getElementById("vehicle_name").innerText=JsonDate["data_dic"]["vehicles"];
                            document.getElementById("driver_name").innerText=JsonDate["data_dic"]["drivers"];
                        }

                        var use_car_leaders = document.getElementById("use_car_leaders");
                        for (var i=0; i<returnList.length; i++){
                            var option = document.createElement("option");
                            {#<option value="梁东(6688)">梁东</option>#}
                            option.innerHTML = returnList[i]["name"];option.setAttribute('value', returnList[i]["name"]+'('+returnList[i]["name"]+")");
                            if (JsonDate["data_dic"]["field_leader"] === returnList[i]["name"]){
                                option.setAttribute("selected", "selected");
                            }
                            use_car_leaders.appendChild(option);
                        }


                        var realname = "{{ realname | safe }}";
                        if (realname === "孔智慧"){
                            creat_option(JsonDate["data_dic"]["vehicle_list"], JsonDate["data_dic"]["driver_list"]);
                        }

                        var fg_leder = document.getElementById("fg");
                        for (var fg=0; fg<JsonDate["data_dic"]["audit_list"]["B"].length; fg++){
                            if (JsonDate["data_dic"]["audit_list"]['B'][fg]["state"] !== "待审核"){
                                var fg_hr = document.createElement("hr");fg_hr.style.marginTop="3px";
                                var fg_all_div = document.createElement("div");fg_all_div.style.width="100%";fg_all_div.style.height="100%";fg_all_div.style.position="relative";
                                var fg_div = document.createElement("div");var status_fg = document.createElement("p");status_fg.innerText=JsonDate["data_dic"]["audit_list"]["B"][fg]["state"];
                                var opine_fg = document.createElement("p");opine_fg.innerText=JsonDate["data_dic"]["audit_list"]['B'][fg]["audit_note"];
                                fg_div.appendChild(status_fg);fg_div.appendChild(opine_fg);
                                var div_img = document.createElement("div");var img_fg = document.createElement("img");img_fg.src=JsonDate["data_dic"]["audit_list"]["B"][fg]["signature_picture"];img_fg.style.width="150px";img_fg.style.height="60px";div_img.appendChild(img_fg);
                                var fg_time = document.createElement("div");fg_time.style.position="absolute";fg_time.style.bottom='0';fg_time.style.right='0';fg_time.style.width='300px';fg_time.style.textAlign='right';fg_time.style.color='#0b0b0b';fg_time.innerText=JsonDate["data_dic"]["audit_list"]["B"][fg]["audit_time"];
                                fg_all_div.appendChild(fg_div);fg_all_div.appendChild(div_img);fg_all_div.appendChild(fg_time);fg_all_div.appendChild(fg_hr);fg_leder.appendChild(fg_all_div);
                            }
                        }

                        var yb_leder = document.getElementById("yb");
                        for (var YB=0; YB<JsonDate["data_dic"]["audit_list"]["YB"].length; YB++){
                            if (JsonDate["data_dic"]["audit_list"]['YB'][YB]["state"] !== "待审核"){
                                var yb_hr = document.createElement("hr");yb_hr.style.marginTop="3px";
                                var yb_all_div = document.createElement("div");yb_all_div.style.width="100%";yb_all_div.style.height="100%";yb_all_div.style.position="relative";
                                var yb_div = document.createElement("div");var status_yb = document.createElement("p");status_yb.innerText=JsonDate["data_dic"]["audit_list"]["YB"][YB]["state"];
                                var opine_yb = document.createElement("p");opine_yb.innerText=JsonDate["data_dic"]["audit_list"]['YB'][YB]["audit_note"];
                                yb_div.appendChild(status_yb);yb_div.appendChild(opine_yb);
                                var yb_div_img = document.createElement("div");var img_yb = document.createElement("img");img_yb.src=JsonDate["data_dic"]["audit_list"]["YB"][YB]["signature_picture"];img_yb.style.width="150px";img_yb.style.height="60px";yb_div_img.appendChild(img_yb);
                                var yb_time = document.createElement("div");yb_time.style.position="absolute";yb_time.style.bottom='0';yb_time.style.right='0';yb_time.style.width='300px';yb_time.style.textAlign='right';yb_time.style.color='#0b0b0b';yb_time.innerText=JsonDate["data_dic"]["audit_list"]["YB"][YB]["audit_time"];
                                yb_all_div.appendChild(yb_div);yb_all_div.appendChild(yb_div_img);yb_all_div.appendChild(yb_time);yb_all_div.appendChild(yb_hr);yb_leder.appendChild(yb_all_div);
                            }
                        }

                        var cg_leder = document.getElementById("cg");
                        for (var CGB=0; CGB<JsonDate["data_dic"]["audit_list"]["CGB"].length; CGB++){
                            if (JsonDate["data_dic"]["audit_list"]['CGB'][CGB]["state"] !== "待审核"){
                                var cg_hr = document.createElement("hr");cg_hr.style.marginTop="3px";
                                var cg_all_div = document.createElement("div");cg_all_div.style.width="100%";cg_all_div.style.height="100%";cg_all_div.style.position="relative";
                                var cg_div = document.createElement("div");var status_cg = document.createElement("p");status_cg.innerText=JsonDate["data_dic"]["audit_list"]["CGB"][CGB]["state"];
                                var opine_cg = document.createElement("p");opine_cg.innerText=JsonDate["data_dic"]["audit_list"]['CGB'][CGB]["audit_note"];
                                cg_div.appendChild(status_cg);cg_div.appendChild(opine_cg);
                                var cg_div_img = document.createElement("div");var img_cg = document.createElement("img");img_cg.src=JsonDate["data_dic"]["audit_list"]["CGB"][CGB]["signature_picture"];img_cg.style.width="150px";img_cg.style.height="60px";cg_div_img.appendChild(img_cg);
                                var cg_time = document.createElement("div");cg_time.style.position="absolute";cg_time.style.bottom='0';cg_time.style.right='0';cg_time.style.width='300px';cg_time.style.textAlign='right';cg_time.style.color='#0b0b0b';cg_time.innerText=JsonDate["data_dic"]["audit_list"]["CGB"][CGB]["audit_time"];
                                cg_all_div.appendChild(cg_div);cg_all_div.appendChild(cg_div_img);cg_all_div.appendChild(cg_time);cg_all_div.appendChild(cg_hr);cg_leder.appendChild(cg_all_div);
                            }
                        }
                    }
                }
            };
        }

        function summit_data() {
            var present_id = window.location.href.split("id=")[1].replace("#", '');
            var approve = $("input[type=radio][name=approve]:checked").val();
            var audit_note = document.getElementById("opinion_detail").value;
            var vehicles = $("#select_tag").find("option:selected").text();
            var drivers = $("#select_drive").find("option:selected").text();

            if (approve === "draft"){
                if (!audit_note){
                    alert("不同意请填写理由！");
                    return false
                }
            }
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/VehicleApplyDetail");
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send("id="+present_id+"&state="+String(approve)+"&audit_note="+String(audit_note)+"&vehicles="+String(vehicles)+"&drivers="+String(drivers));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200){
                            alert("审批成功");
                            window.location.href="/personal-center/process_management.html?type=我的待办&folw_type=&folw=&page=1&page_size=20&wd=";
                        }else {
                            alert(JsonDate["message"]);
                        }
                    }
                }
            };
        }

        function online_tag() {
            document.getElementById("new_models").style.display="table";
        }

        function close_models() {
            document.getElementById("new_models").style.display="none";
        }

        var driver_dict = {};
        function creat_option(vehicle_list, driver_list) {
            var select_tag = document.getElementById("select_tag");
            var select_drive = document.getElementById("select_drive");
            document.getElementById("select_option").style.display = "inline-block";
            for (var t=0;t<vehicle_list.length;t++){
                var option = document.createElement("option");
                option.innerHTML = vehicle_list[t]["number"];
                select_tag.appendChild(option);
                {#driver_dict[JsonData[t]["number"]] = JsonData[t]["driver"];#}
            }
            for (var r=0;r<driver_list.length;r++){
                var option1 = document.createElement("option");
                option1.innerHTML = driver_list[r]["name"];
                select_drive.appendChild(option1);
            }
        }

        function change_car() {
            var car_num = $("#select_tag").find("option:selected").text();
            document.getElementById("drover").value=driver_dict[car_num];
        }

        function entrust() {
            sessionStorage.clear();
            document.getElementById("addForm").style.display="table-row";
            document.getElementById("an_branch").style.color = "#01aaed";
            document.getElementById("an_rank").style.color = "#0b0b0b";
            document.getElementById("an_func").style.color = "#0b0b0b";
            document.getElementById("all_select_checkbox").checked = false;
            var check_box_list = document.getElementsByClassName("check_box");
            document.getElementById("search_button").setAttribute("onclick", "search_data()");
            document.getElementById("an_branch").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_rank").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_func").setAttribute("onclick", "change_left_val(this.id)");
            for (var t = 0; t < check_box_list.length; t++) {
                document.getElementById(check_box_list[t].id).checked = false;
            }
            document.getElementById("checked-label").innerHTML = "";

            deltr1();
            document.getElementById("img-display1").style.display = "inline-block";
            if (window.branch_list) {
                var branch_list = window.branch_list;
                var department_list = document.getElementById("department_list");
                department_list.innerHTML = "";
                var ul_tag = document.createElement("ul");
                ul_tag.style.fontSize = "0";
                ul_tag.style.margin = "0";
                ul_tag.style.padding = "0";
                for (var i = 0; i < branch_list.length; i++) {
                    var li_tag = document.createElement("li");
                    li_tag.style.fontSize = "14px";
                    li_tag.style.margin = "0";
                    li_tag.style.padding = "0";
                    li_tag.innerHTML = "<p style='margin-left: 20%;'>" + branch_list[i] + "</p>";
                    li_tag.setAttribute("onclick", "choice_peopel('" + branch_list[i] + "')");
                    li_tag.setAttribute("id", branch_list[i]);
                    li_tag.className = "li-class";
                    ul_tag.appendChild(li_tag);
                    department_list.appendChild(ul_tag);
                }
            } else {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/technological/delegation", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send();
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            var JsonDate = JSON.parse(xhr.responseText);
                            window.personnel_list = JsonDate["data"];
                            window.emp_info_dict = JsonDate["emp_info_dict"];
                            window.people_dict = JsonDate["people_dict"];
                            window.people_dict_new = JsonDate["people_dict_new"];
                            window.branch_list = JsonDate["branch_list"];
                            window.function_list = JsonDate["function_list"];
                            var department_list = document.getElementById("department_list");
                            department_list.innerHTML = "";
                            var ul_tag = document.createElement("ul");
                            ul_tag.style.fontSize = "0";
                            ul_tag.style.margin = "0";
                            ul_tag.style.padding = "0";
                            for (var i = 0; i < JsonDate["branch_list"].length; i++) {
                                var li_tag = document.createElement("li");
                                li_tag.style.fontSize = "14px";
                                li_tag.style.margin = "0";
                                li_tag.style.padding = "0";
                                li_tag.innerHTML = "<p style='margin-left: 20%;'>" + JsonDate["branch_list"][i] + "</p>";
                                li_tag.setAttribute("onclick", "choice_peopel('" + JsonDate["branch_list"][i] + "')");
                                li_tag.setAttribute("id", JsonDate["branch_list"][i]);
                                li_tag.className = "li-class";
                                ul_tag.appendChild(li_tag);
                                department_list.appendChild(ul_tag);
                            }
                        }
                    }
                }
            }
        }

        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        function change_left_val(ele_id) {
            if (ele_id === "an_rank") {
                document.getElementById("an_branch").style.color = "#0b0b0b";
                document.getElementById("an_func").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var new_branch_list = ["书记、院长:A", "院领导:B", "职能科室负责人:C", "临床医技科室负责人:D", "副主任:G", "护士长:E","普通员工:F"];
                var new_department_list = document.getElementById("department_list");
                var new_ul_tag = document.createElement("ul");
                new_ul_tag.style.fontSize = "0";
                new_ul_tag.style.margin = "0";
                new_ul_tag.style.padding = "0";
                for (var EF = 0; EF < new_branch_list.length; EF++) {
                    var new_li_tag = document.createElement("li");
                    new_li_tag.style.fontSize = "14px";
                    new_li_tag.style.margin = "0";
                    new_li_tag.style.padding = "0";
                    new_li_tag.style.paddingLeft = "5%";
                    new_li_tag.innerHTML = "<p>" + new_branch_list[EF].split(":")[0] + "</p>";
                    new_li_tag.setAttribute("onclick", "choice_peopel_1('" + new_branch_list[EF].split(":")[1] + "')");
                    new_li_tag.setAttribute("id", new_branch_list[EF].split(":")[1]);
                    new_li_tag.className = "li-class";
                    new_ul_tag.appendChild(new_li_tag);
                    new_department_list.appendChild(new_ul_tag);
                }
            } else if (ele_id === 'an_func') {
                document.getElementById("an_branch").style.color = "#0b0b0b";
                document.getElementById("an_rank").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var department_list_1 = document.getElementById("department_list");
                var ul_tag_1 = document.createElement("ul");
                ul_tag_1.style.fontSize = "0";
                ul_tag_1.style.margin = "0";
                ul_tag_1.style.padding = "0";
                var function_list = window.function_list;
                var func_list = [];
                for (var tt in function_list['function_dict']) {
                    func_list.push(tt);
                }
                console.log(func_list)
                for (var AB = 0; AB < func_list.length; AB++) {
                    var new_li_1 = document.createElement("li");
                    new_li_1.style.fontSize = "14px";
                    new_li_1.style.margin = "0";
                    new_li_1.style.padding = "0";
                    new_li_1.style.paddingLeft = "5%";
                    new_li_1.innerHTML = "<p>" + func_list[AB] + "</p>";
                    new_li_1.setAttribute("onclick", "choice_peopel_2('" + function_list['function_dict'][func_list[AB]] + "')");
                    new_li_1.setAttribute("id", function_list['function_dict'][func_list[AB]]);
                    new_li_1.className = "li-class";
                    ul_tag_1.appendChild(new_li_1);
                    department_list_1.appendChild(ul_tag_1);
                 }
            } else {
                document.getElementById("an_rank").style.color = "#0b0b0b";
                document.getElementById("an_func").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var branch_list = window.branch_list;
                var department_list = document.getElementById("department_list");
                department_list.innerHTML = "";
                var ul_tag = document.createElement("ul");
                ul_tag.style.fontSize = "0";
                ul_tag.style.margin = "0";
                ul_tag.style.padding = "0";
                for (var i = 0; i < branch_list.length; i++) {
                    var li_tag = document.createElement("li");
                    li_tag.style.fontSize = "14px";
                    li_tag.style.margin = "0";
                    li_tag.style.padding = "0";
                    li_tag.innerHTML = "<p style='margin-left: 20%;'>" + branch_list[i] + "</p>";
                    li_tag.setAttribute("onclick", "choice_peopel('" + branch_list[i] + "')");
                    li_tag.setAttribute("id", branch_list[i]);
                    li_tag.className = "li-class";
                    ul_tag.appendChild(li_tag);
                    department_list.appendChild(ul_tag);
                }
            }
        }

        // 创建右侧选择人员列表
        function choice_peopel_1(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }
            var people_dict = window.people_dict;
            var people_dict_new = window.people_dict_new;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', 'executor2')")
            for (var i = 0; i < people_dict_new[choice_key].length; i++) {
                var elm = people_dict_new[choice_key];
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                {#console.log('elm[i]', elm[i])#}
                td.innerHTML = "<input id='" + elm[i].real_name+'('+elm[i].job_number+')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }
            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        // 创建右侧选择人员列表
        function choice_peopel_2(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }

            var people_dict_new = window.function_list;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', 'executor2')")
            for (var i = 0; i < people_dict_new[choice_key].length; i++) {
                var elm = people_dict_new[choice_key];
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                {#console.log('elm[i]', elm[i])#}
                td.innerHTML = "<input id='" + elm[i].real_name + '(' + elm[i].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }
            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        function choice_peopel(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }
            var emp_info_dict = window.emp_info_dict;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', '" + chose_id + "')");

            for (var i = 0; i < emp_info_dict[choice_key].length; i++) {
                var elm = emp_info_dict[choice_key]
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                {#console.log('elm[i]', elm[i])#}
                td.innerHTML = "<input id='" + elm[i].real_name+"("+elm[i].job_number+')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }

            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        // 复选框全选
        function check_all_select(choice_key, chose_id) {
            var select_check = document.getElementById("all_select_checkbox").checked;
            var all_check_box = document.getElementsByClassName("check_box");
            chose_id = 'executor2'
            if (chose_id === "executor2") {
                var tag_id = "executor_str";
            } else {
                tag_id = "executor_str1";
            }

            var executor_list = [];
            var executor_str = document.getElementById(tag_id);
            if (executor_str) {
                if (executor_str.innerText.trim()) {
                    executor_list = executor_str.innerText.split(", ")
                }
            }

            var new_check_val_list = [];
            var check_val_list = [];
            for (var HH = 0; HH < all_check_box.length; HH++) {
                all_check_box[HH].checked = true;
                check_val_list.push(all_check_box[HH].id);
                if (executor_list.lastIndexOf(all_check_box[HH].id) === -1) {
                    new_check_val_list.push(all_check_box[HH].id)
                }
            }

            if (select_check) {
                if (chose_id === "executor2" || chose_id === "executor4") {

                    if (executor_str) {
                        if (executor_str.innerText.trim()) {
                            document.getElementById(tag_id).innerHTML = executor_str.innerText + ", " + new_check_val_list.join(", ");
                        } else {
                            document.getElementById(tag_id).innerHTML = new_check_val_list.join(", ");
                        }

                    } else {
                        document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + check_val_list.join(", ") + "</span>";
                    }
                    sessionStorage.setItem(choice_key, "all" + ", " + check_val_list.join(", "))
                } else {
                    alert("该节点不能多选！");
                    document.getElementById("all_select_checkbox").checked = false;
                }
            } else {
                sessionStorage.removeItem(choice_key);
                check_val_list = [];
                for (var II = 0; II < all_check_box.length; II++) {
                    all_check_box[II].checked = false;
                    check_val_list.push(all_check_box[II].id);
                }
                var old_check_val = document.getElementById(tag_id).innerHTML.split(", ");
                console.log(old_check_val)
                for (var TB = 0; TB < check_val_list.length; TB++) {
                    removeByValue(old_check_val, check_val_list[TB])
                }

                document.getElementById(tag_id).innerHTML = old_check_val.join(", ");
            }
        };

        function removeByValue(arr, val) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] === val) {
                    arr.splice(i, 1);
                    break;
                }
            }
        };

        // 选择委托人
        function choice_consignor(ele_id, chose_id, choice_key) {
            chose_id = 'executor2';
            if (chose_id === "executor2" || chose_id === "executor4") {
                var dataStr = sessionStorage.getItem(choice_key);
                var dataList = [];
                if (dataStr) {
                    sessionStorage.setItem(choice_key, dataStr + ", " + ele_id)
                } else {
                    sessionStorage.setItem(choice_key, ele_id)
                }

                if (chose_id === "executor2") {
                    var tag_id = "executor_str";
                } else {
                    tag_id = "executor_str1";
                }
                var executor_str = document.getElementById(tag_id);
                if (executor_str) {
                    if (document.getElementById(ele_id).checked) {
                        if (executor_str.innerText.trim()){
                            document.getElementById(tag_id).innerHTML = executor_str.innerText + ", " + ele_id;
                        }else {
                            document.getElementById(tag_id).innerHTML = ele_id;
                        }
                    } else {
                        var str_push = [];
                        var executor_list = executor_str.innerText.split(", ");
                        for (var kl = 0; kl < executor_list.length; kl++) {
                            if (executor_list[kl] !== ele_id) {
                                str_push.push(executor_list[kl])
                            }
                        }
                        document.getElementById(tag_id).innerHTML = str_push.join(", ")
                    }
                } else {
                    document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + ele_id + "</span>";
                }
            } else {
                check_more_one_not(ele_id);
                document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;'>" + ele_id + "</span>";
            }

        }

        function summit_val() {
            var executor111 = '';
            var checked_label = document.getElementById("checked-label");
            for (var j = 0; j < checked_label.children.length; j++) {
                executor111 = executor111 + checked_label.children[j].innerText.trim() + ", ";
            }
            document.getElementById("addForm").style.display = "none";
            var executor_people = executor111.slice(0, -2);
            document.getElementById("field").innerText=executor_people;
        };

        function search_data() {
            var searchData = document.getElementById("search_data").value;
            var emp_info_dict = window.emp_info_dict;
            console.log(emp_info_dict);
            var searchValNum = 1;
            var department_list = document.getElementById("department_list");
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('all')");
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            t_table.innerHTML="";
            for (var i in emp_info_dict){
                for (var j=0; j<emp_info_dict[i].length; j++){
                    if (emp_info_dict[i][j]["real_name"].indexOf(searchData) !== -1){
                        var elm = emp_info_dict[i];
                        var tr = document.createElement("tr");
                        var td = document.createElement("td");
                        var td1 = document.createElement("td");
                        var td2 = document.createElement("td");
                        var td3 = document.createElement("td");
                        td.innerHTML = "<input id='" + elm[j].real_name + "(" + elm[j].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + i + "\")'>";
                        td.style.textAlign = "center";
                        td1.innerHTML = searchValNum;
                        td1.style.textAlign = "center";
                        td2.innerHTML = elm[j].real_name;
                        td2.title = elm[j].real_name;
                        td2.style.textAlign = "center";
                        td3.innerHTML = elm[j].job_number;
                        td3.title = elm[j].job_number;
                        td3.style.textAlign = "center";
                        tr.appendChild(td);
                        tr.appendChild(td1);
                        tr.appendChild(td2);
                        tr.appendChild(td3);
                        t_table.appendChild(tr);
                        searchValNum += 1;
                    }
                }
            }
        }

        function close_models1() {
            document.getElementById("addForm").style.display = "none";
        }

        function ExportCar() {
            var car_detail_id = window.location.href.split("id=")[1].replace("#", '');
            document.getElementById("loading").style.display = "inline-block";
            var car_start = document.getElementById('car_start1').value;             // 开始时间
            var car_end = document.getElementById('car_end1').value;         // 结束时间
            var itinerary = document.getElementById("itinerary").innerText;         // 行程路线
            // var travlled_distance = document.getElementById("travlled_distance").innerText;         // 行驶里程

            var field_people = document.getElementById("field").innerText;      // 同行人员
            var car_marks = document.getElementById('car_marks').innerText;             // 用车是由

            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/personal-center/vehicle_apply_write_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.send("subject=" + String(car_marks) + "&start_time=" + String(car_start) + "&end_time=" + String(car_end) + "&route=" + String(itinerary) + "&travelers_users=" + String(field_people) + "&is_fix=&id="+String(car_detail_id));
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 200){
                            alert("保存成功");
                            window.location = "/personal-center/vehicle_use_info_view";
                            document.getElementById("loading").style.display = "none";
                        }
                        else {
                            alert(JsonDate['message']);
                            document.getElementById("loading").style.display = "none";
                        }
                    }
                }
            };

        }
    </script>
{% endblock %}
